package com.example.steveaoblogdemo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.steveaoblogdemo.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper extends BaseMapper<User> {
    @Insert("insert into user (id,username,nickname,password,avatar,sex,email,resume,salt,recommend,role) values (" +
            "#{id},#{username},#{nickname},#{password},#{avatar},#{sex},#{email},#{resume},#{salt},#{recommend},#{role})")
    int addUser(Integer id,String username,String nickname,String password,String avatar,String sex,String email,String resume,Integer salt,Integer recommend,Integer role);

    @Update("update user set username=#{username},nickname=#{nickname},password=#{password},avatar=#{avatar}," +
            "sex=#{sex},email=#{email},resume=#{resume},salt=#{salt},recommend=#{recommend},role=#{role} where id=#{id}")
    int updateUser(String username,String nickname,String password,String avatar,String sex,String email,String resume,Integer salt,Integer recommend,Integer role,Integer id);
}
